<template>
  <div class="assemble">
    <header>
      <div class="assemble_header">
        <img src="../../assets/img/zuojiantou.png" alt="" @click="back">
        我的订单
      </div>
      <!--   订单分类   -->
      <div class="assembleList">
        <router-link v-for="(x,y) in assembleList" :to="x.page" tag="div" class="abList_box" :key="y" replace>
          <p :class="x.page != present?'selected':''">{{x.text}}</p>
          <transition name="el-zoom-in-center">
            <p v-show="x.page == present"></p>
          </transition>
        </router-link>
      </div>
    </header>

    <router-view></router-view>
  </div>
</template>

<script>
  export default {
    name: "assemble",
    data() {
      return {
        assembleList: [{text: '全部', page: '/components/ClientComponents/order/orderAll'},{text: '待付款', page: '/components/ClientComponents/order/ToBePaid'},{text: '待配送', page: '/components/ClientComponents/order/ToBeDelivered'}, {text: '配送中', page: '/components/ClientComponents/order/delivery'}, {text: '待评价', page: '/components/ClientComponents/order/orderEvaluate'}, {text: '已完成', page: '/components/ClientComponents/order/completed'}],
        present: '/components/ClientComponents/order/orderAll'
      }
    },
    methods: {
      back() {
        this.$router.back();
      },
    },
    mounted() {
      this.present = this.$route.path;
    },
    watch: {
      $route(to, from) {
        this.present = to.path;
      }
    }
  }
</script>

<style scoped>
  .assemble {
    width: 100%;
    padding-top: .9rem;
    min-height: 5.77rem;
    background-color: #F5F5F5;
  }

  .assemble header {
    width: 100%;
    position: fixed;
    top: -.01rem;
    left: 0;
    z-index: 999999;
    height: .91rem;
    text-align: center;
    color: #ffffff;
  }

  .assemble_header {
    height: .5rem;
    width: 100%;
    position: relative;
    line-height: .5rem;
    font-size: .18rem;
    background:linear-gradient(90deg,rgba(255,142,65,1) 0%,rgba(255,142,65,1) 53%,rgba(255,110,0,1) 100%);
  }

  .assemble_header img {
    width: .10rem;
    height: .18rem;
    position: absolute;
    left: .13rem;
    top: calc(50% - .09rem);
  }

  /* 拼团分类部分 */
  .assembleList {
    width: 100%;
    height: 100%;
    max-height: .35rem;
    display: flex;
    flex-flow: row;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
  }

  .abList_box {
    height: 100%;
    max-height: .5rem;
    width: calc(100% / 5);
    display: flex;
    flex-flow: column;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding-bottom: .05rem;
  }

  .abList_box > p:nth-child(1) {
    color: #333333;
    font-size: .15rem;
    line-height: .15rem;
    padding-top: .1rem;
  }

  .abList_box > p:nth-child(2) {
    width: .18rem;
    height: .02rem;
    background-color: #FF300D;
    border-radius: .01rem;
  }


  .el-loading-spinner {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    min-height: 5rem;
  }

  .selected {
    color: #666666 !important;
    font-size: .13rem !important;
  }
</style>
